

#include <UndefCSharpKeywords.h>
#include <CSharpLock.h>
#include <CSharpMutex.h>

Lock::Lock(Mutex* p_mutex)
	: m_mutex(p_mutex)
{
	this->m_mutex->Lock();
}
Lock::~Lock()
{
	this->m_mutex->Unlock();

	this->m_mutex->_count--;

	if(this->m_mutex->_count == 0)
	{
		delete m_mutex;
		m_mutex = 0;
	}
}